<!-- 模板 -->
<template>
  <div class="withdrawal">
      <div class="box">
          <el-card>
            <el-table :data="tableData" border style="width: 100%" >
                <el-table-column  label="序号" align="center" type="index"> </el-table-column>
                <el-table-column prop="name" label="提现人" align="center" > </el-table-column>
                <el-table-column prop="phone" label="联系方式" align="center" > </el-table-column>
                <el-table-column prop="price" label="提现金额" align="center" > </el-table-column>
                <el-table-column prop="createTime" label="申请时间" align="center" > </el-table-column>
                <el-table-column prop="content" label="备注" align="center" > </el-table-column>
                <el-table-column  label="操作" align="center" >
                    <template slot-scope="scope">
                        <el-button @click="agree(scope.row)" type="primary" size="small" icon="el-icon-check" plain>同 意</el-button>
                        <el-button @click="refuse(scope.row)" type="danger" size="small" icon="el-icon-circle-close" plain>拒 绝</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </el-card>
        <pagination
        v-show="total >0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getInformationList"
        />
      </div>
<el-dialog
  title="拒绝"
  :visible.sync="dialogVisible"
  width="35%"
  :before-close="handleClose">
<el-form  label-width="120px" :model="form">
    <el-form-item label="拒绝原因" prop="reason">
      <el-input v-model="form.reason" type="textarea"></el-input>
    </el-form-item>
</el-form>
  <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="onSubmit">确 定</el-button>
  </span>
</el-dialog>
  </div>
</template>

<script>
import {getList,payMent,getExamine,getDsc} from '@/api/finance/index'
export default {
  name: '',
  data () {
    return {
        tableData:[],
        loading:false,
        form:{
          status : undefined,
          name:'',
        },
        dialogVisible:false,
        queryParams: {
            pageNum: 1,
            pageSize: 10,
            status:1,
        },
        total:0,
    }
  },
  props: [],
  components: {},
  computed: {},
  filters: {},
  methods: {
    onSubmit(){
      getExamine(this.form).then(res =>{
        if(res.code == 200){
          this.dialogVisible = false
          this.getInformationList();
          this.$message.success('已拒绝')
        }
      })
    },
    handleClose(){
      this.dialogVisible = false
    },
    refuse(row){
      this.dialogVisible = true
      this.form = row
      this.form.status = 0
    },
    agree(row){
      this.form = row
      this.form.status = 2
      // console.log(id)
      getExamine(this.form).then(res =>{
        if(res.code == 200){
          this.getInformationList();
          this.$message.success('通过成功')
        }
      })
    },
      // 获取所有
    getInformationList() {
      this.loading = true;
      getList(this.queryParams).then(res => {
        this.tableData = res.rows
        // console.log(this.tableData);
        this.total = res.total;
        this.loading = false;
      });
    },
  },
  created () {
    this.getInformationList()
  },
  mounted () {}
}
</script>

<style rel="stylesheet/scss" lang="scss">
.box{
    margin: 10px;
    // .btn{
    //     margin-top: 20px;
    // }
}
</style>
